//
//  AnchorViewController.m
//  LearnObjectiveC
//
//  Created by 吴可高 on 16/6/23.
//  Copyright © 2016年 吴可高. All rights reserved.
//

#import "AnchorViewController.h"

@interface AnchorViewController ()

@end

@implementation AnchorViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self  setObjectView];
}
#pragma mark ViewController AsynRequestData

#pragma mark ViewController Algorithm Processor

#pragma mark ViewController Initialize SubObjectView
-(void)setObjectView
{
    UIView * anchorContentView = [[UIView alloc]initWithFrame:CGRectMake(0, kNavigationBarHeight, kScreen_Width, kScreen_Height - kNavigationBarHeight)];
    anchorContentView.backgroundColor  = [UIColor lightGrayColor];
    [self.view addSubview:anchorContentView];
    // AnchorView
    UIView * anchor = [[UIView alloc]initWithFrame:CGRectMake(0,0, 200, 200)];
    anchor.layer.anchorPoint  = CGPointMake(0.25, 0.25);
    /**   关于UIView.layer
     *  这样可以去推导公式:layer.position.x  =  layer.frame.origin.x  +   layer.anchor.x * layer.frame.size.with
     *
     //
         layer.frame.origin.x   = layer.position.x  -  layer.anchor.x  * layer.frame.size.width;
     */
    anchor.backgroundColor = [UIColor redColor];
    [anchorContentView addSubview:anchor];
}

#pragma mark --viewController getter methods

#pragma mark Possess  Delegate ViewController（委托代理者）
#pragma mark IBOutlet Action ViewController

#pragma mark Other Method
-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
}
@end
